import java.util.NoSuchElementException;
import java.util.Scanner;

public class exceptions_work3 {
    public static void main(String args[]) {
        Scanner reader = new Scanner(System.in);
        int score;
        while (true) {
            String operator = reader.next();
            if (operator.compareTo("new") == 0) {
                try{
                    String name = reader.next();
                    score = Integer.parseInt(reader.nextLine().substring(1));
                    Student person = new Student(name, score);
                }catch(Exception e){
                    System.out.println(new NoSuchElementException());
                }
            } else {
                break;
            }
        }
        reader.close();
        System.out.println("scanner closed");
    }
}

class Student {
    private String name="null";
    private int score=0;

    Student(String name, int score) {
        boolean flag = false;
        boolean flag2 = false;
        try{
            setName(name);
            flag = true;
        }catch(Exception e){
            System.out.println(e);
        }
        try {
            addScore(score);
            flag2 = true;
        } catch (Exception e) {
            System.out.println(e);
        }
        if(flag && flag2){
            System.out.println(this);
        }
    }

    void setName(String name) throws IllegalNameException {
        if (name.charAt(0) >= '0' && name.charAt(0) <= '9') {
            throw new IllegalNameException(name);
        } else {
            this.name = name;
        }
    }

    public int addScore(int score) throws IllegalScoreException {
        if (score < 0 || score > 100) {
            throw new IllegalScoreException(score);
        } else {
            this.score = score;
            return score;
        }
    }

    public String toString() {
        return "Student [name=" + name + ", score=" + score + "]";
    };
}

class IllegalScoreException extends Exception {
    public IllegalScoreException() {
    }

    public IllegalScoreException(int score) {
        super("score out of range, score=" + Integer.toString(score));
    }
}

class IllegalNameException extends Exception {
    public IllegalNameException() {
    }

    public IllegalNameException(String name) {
        super("the first char of name must not be digit, name=" + name);
    }
}
